home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
CLSTRING.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-02
|
4KB
|
128 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: clstring.hpp
// Title: C++ Class Libraries
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module contains code for the class CL_STRING.
// This code manages dynamically allocated strings.
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Class CL_STRING
//----------------------------------------------------------------------------
CLASSDEF(CL_STRING);
#define CL_STRING_PARENT CL_OBJECT
class CLASSTYPE CL_STRING : public CL_STRING_PARENT
{
protected:
SIZET cBuf; // Length of string buffer
// 0 if no string allocated
PSZ pszBuf; // Pointer to string, or NULL
// String is zero terminated
public:
FN_M CL_STRING(SIZET = 0);
FN_M CL_STRING(SIZET, PCSZ, va_list);
FN_MV CL_STRING(PCSZ...);
FN_M CL_STRING(RCCL_STRING);
virtual FN_M ~CL_STRING();
BOOL FN_M AppendCharCond(CHAR);
CHAR FN_M Char(SIZET = 0) const;
PSZ FN_M Chr(CHAR) const;
BOOL FN_M Concat(CHAR);
BOOL FN_M Concat(PCSZ);
BOOL FN_M Concat(PCCHAR, SIZET);
BOOL FN_M Concat(RCL_STRING);
BOOL FN_M Copy(PCSZ);
BOOL FN_M Copy(PCCHAR, SIZET);
BOOL FN_M Copy(RCCL_STRING);
SIZET FN_M Count(CHAR) const;
BOOL FN_M Create(SIZET = 0, PCSZ = NULL);
BOOL FN_M Create(SIZET, PCSZ, va_list);
virtual BOOL FN_M Destroy(BOOL = TRUE);
VOID FN_M Empty();
BOOL FN_M Extract(RCL_STRING, SHORT = 0, PCSZ = NULL) const;
ULONG FN_M Hash() const;
virtual BOOL FN_M Initialize(SHORT = CL_INIT_ALL);
SIZET FN_M IsEmpty() const
{
return !cBuf || !pszBuf[0];
}
virtual BOOL FN_M IsValid() const;
SIZET FN_M Len() const;
BOOL FN_M Lower();
RCCL_STRING FN_M operator=(RCCL_STRING);
RCL_STRING FN_M operator=(PCSZ);
RCL_STRING FN_M operator+=(CHAR);
RCL_STRING FN_M operator+=(PCSZ);
RCL_STRING FN_M operator+=(RCCL_STRING);
CHAR FN_M operator[](SIZET) const;
RCL_STRING FN_MV operator()(PCSZ psz...);
FN_M operator PSZ() const
{
return pszBuf;
}
FN_M operator PCSZ() const
{
return (PCSZ)pszBuf;
}
PSZ FN_M Ptr(SIZET = 0) const;
PSZ FN_M RChr(CHAR) const;
virtual BOOL FN_M Retrieve(PCSZ, PCSZ = NULL);
virtual BOOL FN_M Store(PCSZ, PCSZ = NULL);
BOOL FN_M Trim();
BOOL FN_M TrimLeft();
BOOL FN_M TrimRight();
BOOL FN_M Upper();
CHAR FN_M UpperChar(SIZET = 0) const;
BOOL FN_M ValidLong(PLONG = NULL) const;
BOOL FN_M ValidShort(PSHORT = NULL) const;
BOOL FN_M ValidULong(PULONG = NULL) const;
BOOL FN_M ValidUShort(PUSHORT = NULL) const;
#if COMPILE_DEBUG
static VOID FN_M Print(PCCL_STRING = NULL, PCSZ = NULL, SIZET = 0);
static BOOL FN_M Test(SHORT = 0);
#endif
protected:
private:
static CHAR chNull; // By default, this character is null
};
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------